<template>
  <el-dialog title="患者记录" :visible="value" width="500px" custom-class="dialog-box" @close="onClose" @open="onOpen" :close-on-click-modal="false" :append-to-body="true">
    <el-timeline :reverse="reverse">
      <el-timeline-item v-for="(item, index) in tableList" :key="index" :timestamp="item.dateDay" placement="top">
        <el-card>
          <h3>{{item.registerName}}-{{item.deptName}}</h3>
          <p>医生：{{item.doctorName}}</p>
          <el-link @click="getDetail()">查看详情</el-link>
        </el-card>
      </el-timeline-item>
    </el-timeline>

    <!-- <form class="edit_user_box line_check_box">
      <div class="time-vertical">
        <dl v-for="(item,index) in tableList" class="time_dl_vertical" :key="index">
          <dd :key="index">
            <label class="time_axis_line">
              {{item.dateDay | changeDate}}
              <br />
              <label class="date_year">{{item.dateDay | changeYear}}</label>
            </label>
            <b></b>
            <span>{{item.registerName}}</span>
            <span>{{item.deptName}} - {{item.doctorName}}</span>
            <a @click="getDetail()">查看详情</a>
          </dd>
        </dl>
      </div>
    </form> -->
    <div v-if="tableList.length == 0" style="color:#999;padding:10px 0;text-align:center;">
      <i class="iconfont iconwushuju" style="font-size:40px;"></i>
      <div>暂无数据</div>
    </div>
  </el-dialog>
</template>
<script>
export default {
  props: ["value", "curItem"],
  components: {
  },
  data() {
    return {
      reverse: true,
      pager: { pageSize: 10, pageNum: 1, total: 0 },
      tableList: [],
      form: { patientId: "", hpId: "",isDateDaySort:1 }
    };
  },
  mounted() {
    let th = this;
    th.getRrcordList();
  },
  methods: {
    getRrcordList() {
      let th = this;
      th.form.patientId = th.jieMi(th.$route.query.id);
      th.form.hpId = th.adminUser.hpId;
      let json = Object.assign(th.pager, th.form);
      th.$api
        .getRegisterListInfo(json)
        .then(res => {
          if (res.executed) {
            th.tableList = res.dataBody.list;
          }
        })
        .catch(error => {
          console.log(error);
        });
    },
    getDetail() {
      let th = this;
      th.$emit("detail", 2);
      th.onClose();
    },
    onOpen() {},
    onClose() {
      let th = this;
      th.$emit("input", false);
    }
  },
  filters: {
    changeDate(value) {
      if (value != null) {
        return value.substring(5, 10);
      }
    },
    changeYear(value) {
      if (value != null) {
        return value.substring(0, 4);
      }
    }
  }
};
</script>
<style lang="scss" scoped>
h3 {
  margin-bottom: 5px;
  margin-top: 0;
}
p {
  margin-bottom: 10px;
}
</style>
